function attrs(attrsString) {
  if(attrsString==undefined)return []
  var isBool = false;
  var i = 0;
  var result = []
  for (let index = 0; index < attrsString.length; index++) {
    let char = attrsString[index]
    if(char == '"'){
      isBool = !isBool
    }else if(char  == ' ' && !isBool){
      // console.log(attrsString.substring(i,index).match(/^\s*$/))
      if(!/^\s*$/.test(attrsString.substring(i,index))){
        // console.log(attrsString.substring(i,index).trim())
        result.push(attrsString.substring(i,index).trim())
      }
      i = index;
    }
    
  }
  result.push(attrsString.substring(i).trim())
  // console.log(result)
  result = result.map((item)=>{
    var o = item.match(/^(.+)="(.+)"$/)
    if(o==null){
      o = item.match(/^(.+)=(.+)$/)
      o[2] = true
    }
    return {
      name:o[1],
      value:o[2]
    }
  })
  return result;
}
export {attrs}